<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>{$meta_title}</title>
    <meta name="keywords" content="户学教育">
    <meta name="Description" content="户学教育"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0,  user-scalable=0;"/>
    <link rel="stylesheet" href="{HOME_THEME_PATH}../gw/css/common.css?t={time()}.{rand(10000,9999999)}">
    <link rel="stylesheet" href="{HOME_THEME_PATH}../gw/css/login.css?t={time()}.{rand(10000,9999999)}"/>

    <script type="text/javascript"t src="{THEME_PATH}js/jquery.min.js?t={time()}.{rand(10000,9999999)}"></script>
    <script type="text/javascript"t src="{THEME_PATH}js/dialog-plus.js?t={time()}.{rand(10000,9999999)"></script>
    <script type="text/javascript" src="{THEME_PATH}js/jquery.artDialog.js?t={time()}.{rand(10000,9999999)}&skin=default"></script>
    <script type="text/javascript" src="{THEME_PATH}js/dayrui.js?t={time()}.{rand(10000,9999999)"></script>
    <script type="text/javascript" src="{HOME_THEME_PATH}../gw/js/le_include_head.js?t={time()}.{rand(10000,9999999)}"></script>

    <script name="baidu-koubei-verification" src="//ikoubei.baidu.com/embed/58ea9664cf897d52f78ec69fff1379d6"></script>

</head>
<body>
<div class="main">
    <!-- 头部 -->
    {template "../gw/common.html"}
    <!-- banner -->
    <!-- <div class="part part1"></div> -->
    <div class="part part2 le-login-form">
        <div class="part-cont">
            <!-- <div class="part2-title">登录</div> -->
            <!-- <div class="part2-line"></div> -->
            <div class="form-title">
                <p class="form-main-title">户学名师在线</p>
                <p class="form-sub-title">欢迎来到户学教育</p>
            </div>
            <form action="" method="post" id="myform">
                <div class="le-number">
                    <input type="text" class="input-item input-phone" placeholder="请输入您的手机号" name="mobile">
                    <img src="{HOME_THEME_PATH}../gw/img/clean-2-4.svg" alt="" class="le-clean-phone">
                    <div class="le-error-message"></div>
                </div>
                <div class="le-password">
                    <input type="password" class="input-item input-password" placeholder="请输入您的密码" name="pass">
                    <img src="{HOME_THEME_PATH}../gw/img/clean-2-4.svg" alt="" class="le-clean-pass">
                    <div class="le-error-message"></div>
                </div>
                <div class="form-btn" onclick="dr_login();">登录</div>
                <div class="form-btns">
                    <a class="form-btn1" href="{dr_user_url('register/index')}">快速注册</a>
                    <a class="form-btn2" href="{dr_user_url('forget/index')}">忘记密码？</a>
                </div>
            </form>
        </div>
    </div>
    <!-- 页尾 -->
    {template "../gw/footer.html"}
</div>
</body>
<script>
    function le_error_message(le_position,message){
        $(le_position).text(message).fadeIn();
        $(le_position).delay(2000).fadeOut();
    }

    $(".le-clean-phone").click(function(){
        $(".input-phone").val("");
    });

    $(".le-clean-pass").click(function(){
        $(".input-password").val("");
    });

    $(".input-phone").focusout(function(){
        var phone = $(".input-phone").val();
        if(!phone){
            le_error_message(".le-number >.le-error-message","手机号码不能为空");
            return false;
        }
        if(!(/^1[34578]\d{9}$/.test(phone))){
            le_error_message(".le-number>.le-error-message","手机号格式不对");
            return false;
        }
    });

    $(".input-password").focusout(function(){
        var pass = $(".input-password").val();
        if(!pass) {
            le_error_message(".le-password>.le-error-message", "密码不能为空");
            return false;
        }
    });

    $(".le-login-form .form-btn").click(function(){
        le_login_data();
    });

    function le_login_data(){
        var phone = $(".input-phone").val(),
            pass = $(".input-password").val();
        if(!phone){
            //le_error_message(".le-number >.le-error-message","手机号码不能为空");
            return false;
        }
        if(phone&&!pass){
            //le_error_message(".le-password>.le-error-message","密码不能为空");
            return false;
        }
        if(!(/^1[34578]\d{9}$/.test(phone))){
            //le_error_message(".le-number>.le-error-message","手机号格式不对");
            return false;
        }
        var post = {'phone':phone,'pass':pass};
    }
    function dr_login(){
        var phone = $(".input-phone").val(),
            pass = $(".input-password").val();
        var post = {'phone':phone,'pass':pass};
        $.ajax({type: "POST",dataType:"json", url: "{dr_now_url()}", data: post,
            success: function(data) {
                if (data.status) {
                    //dr_tips('登录成功，即将为您跳转....', 3, 1);
                    $(".le-login-form .form-btn").text("登录成功，即将为您跳转...").css("background","rgb(189, 189, 189)").css("font-size","16px");
                    setTimeout('window.location.href="'+data.backurl+'"', <?php echo $_GET['debug'] ? 999999: 2000;?>,2000);
                } else {
                    //le_error_message(".le-password>.le-error-message",data.code);
                    $('#dr_code_img').click();
                    dr_tips(data.code);
                }
            },
            error: function(HttpRequest, ajaxOptions, thrownError) {
                //alert(HttpRequest.responseText);
            }
        });
    }
</script>
</html>
